package com.gzm.springcloud.controller;

import com.gzm.springcloud.pojo.Dept;
import com.gzm.springcloud.service.DeptClientService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @ClassName DeptController_consumer
 * @Description:
 * @Author gzm
 * @Date 2020/11/23 11:12
 **/
@RestController
@RequestMapping("/consumer")
@Api(description = "服务消费者")
public class DeptController_consumer {

    @Autowired
    private DeptClientService service;

    @PostMapping("/dept/add")
    public boolean add(@RequestBody Dept dept){
        return this.service.add(dept);
    }
    @GetMapping(value="/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id)
    {
        return this.service.get(id);
    }

    @GetMapping(value="/dept/list")
    public List<Dept> list()
    {
        return this.service.list();
    }

}
